import * as geometryEngine from "@arcgis/core/geometry/geometryEngine.js";
import { mapView } from "./map";
import Graphic from "@arcgis/core/Graphic.js";
import { mapPoint } from "@/api/addPoint";

export const buffer = (dis: number) => {
  const bufferGeometry = geometryEngine.geodesicBuffer(
    mapPoint,
    dis,
    "meters"
  ) as __esri.GeometryProperties;
  let symbol = {
    type: "simple-fill",
    color: [0, 0, 255, 0.5],
    outline: {
      color: [0, 0, 255, 1],
      width: 2,
    },
  };
  let pointGraphic = new Graphic({
    geometry: bufferGeometry,
    symbol: symbol,
  });
  mapView.goTo(bufferGeometry);
  mapView.graphics.add(pointGraphic);
};
